package org.management.system.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.management.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述
 * 资源表模块
 * @author jiangyan
 * @date 2019/03/14
 * @description
 * @project management
 */
@Data
@ApiModel(value="资源表")
@EqualsAndHashCode(callSuper = true)
@Table(name = "sys_resource")
public class ResourceEntity extends BaseEntity {
    /**
     * 图标样式编码
     */
    @Column(name = "ICON_NAME")
    @NotEmpty(message = "图标样式编码不能为空")
    @ApiModelProperty(value = "图标样式编码",name = "iconName", required = true)
    private String iconName;

    @Column(name = "RESOURCE_NO")
    @NotEmpty(message = "不能为空")
    @ApiModelProperty(value = "RESOURCE_NO",name = "resourceNo", required = true)
    private String resourceNo;

    /**
     * 资源名称
     */
    @Column(name = "RESOURCE_NAME")
    @NotEmpty(message = "资源名称不能为空")
    @ApiModelProperty(value = "资源名称",name = "resourceName", required = true)
    private String resourceName;

    /**
     * 父级id
     */
    @Column(name = "PARENT_ID")
    @ApiModelProperty(value = "父级id",name = "parentId")
    private String parentId;

    /**
     * 等级
     */
    @Column(name = "LEVEL")
    @ApiModelProperty(value = "等级",name = "level")
    private Integer level;

    /**
     * 资源路径
     */
    @Column(name = "URL")
    @ApiModelProperty(value = "资源路径",name = "url")
    private String url;

    /**
     * 是否叶子节点  1 true 是  0 false 否
     */
    @Column(name = "IS_LEAF")
    @ApiModelProperty(value = "是否叶子节点  1 true 是  0 false 否",name = "isLeaf")
    private Boolean isLeaf;

    @Transient
    private List<ResourceEntity> children = new ArrayList<>();
}